﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using simpleGUI_QLQTPM;

namespace ServiceSearch
{
    public partial class MyUC : UserControl
    {
        public MyUC()
        {
            InitializeComponent();
        }
        double kinhDo;
        public double KinhDo
        {
            get { return kinhDo; }
            set { kinhDo = value; }
        }
        double viDo;


        public double ViDo
        {
            get { return viDo; }
            set { viDo = value; }
        }
        string ghiChu;

        public string GhiChu
        {
            get { return ghiChu; }
            set { ghiChu = value; }
        }
        void btnMap_Click(object sender, EventArgs e)
        {
            MyUC item = (MyUC)((Button)sender).Tag;
            Form_ChiTietDichVu frm = new Form_ChiTietDichVu();
            frm.SetInformation(
                item.lblTenDiaDiem.Text,
                item.lblDiaChi.Text,
                item.lblLoaiHinh.Text,
                item.kinhDo.ToString(),
                item.viDo.ToString(),
                item.GhiChu);
            frm.ShowDialog();

        }
        public MyUC(string strTenDiaDiem, string strDiaChi, string strLoai, string strGhiChu,double _kinhDo,double _viDo)
        {
            InitializeComponent();
            if (null == strTenDiaDiem || null == strDiaChi || null == strLoai)
            {
                return;
            }

            try
            {
                this.lblTenDiaDiem.Text = strTenDiaDiem;
                this.lblDiaChi.Text = strDiaChi;
                this.lblLoaiHinh.Text = "["+strLoai+"]";
                this.lblToaDo.Text = strGhiChu;
                this.KinhDo = _kinhDo;
                this.viDo = _viDo;
                this.GhiChu = strGhiChu;
                this.btnMap.Tag = this;
                this.btnMap.Click +=new EventHandler(btnMap_Click);
                switch (strLoai)
                {
                    case "ATM":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.atm;
                        break;
                    case "Bệnh viện":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_hos;
                        break;
                    case "Trường học":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_school;
                        break;
                    case "Quán café":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_coffee;
                        break;
                    case "Quán ăn":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_quan_an;
                        break;
                    case "Trạm xăng":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_fuel_station;
                        break;
                    case "Shop thời trang":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_fashion_shop;
                        break;
                    case "Tiệm hớt tóc":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_barber;
                        break;
                    case "Karaoke":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_karaoke;
                        break;
                    case "Nhà hàng":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_res;
                        break;
                    case "Khách sạn":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.hotel;
                        break;
                    case "Công viên":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_park;
                        break;
                    case "Chợ":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_market;
                        break;
                    case "Rạp chiếu phim":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_cinema;
                        break;
                    case "Sân bóng đá":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_football;
                        break;
                    case "Bến xe":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_bus_station;
                        break;
                    case "Phòng khám":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.pic_clinic;
                        break;
                    case "Bến xe bus":
                        pbAnhDaiDien.Image = simpleGUI_QLQTPM.Properties.Resources.bus;//pic_bus_stop;
                        break;
                }
            }
            catch (System.Exception ex)
            {
            	
            }
        }

        private void MyUC_MouseLeave(object sender, EventArgs e)
        {
            this.BackColor = Color.SteelBlue;
            this.btnMap.BackColor = Color.SteelBlue;
            this.btnMap.ForeColor = Color.SteelBlue;
        }

        private void MyUC_MouseEnter(object sender, EventArgs e)
        {
            this.BackColor = Color.CornflowerBlue;
            this.btnMap.BackColor = Color.CornflowerBlue;
            this.btnMap.ForeColor = Color.CornflowerBlue;
                
        }

        private void MyUC_Paint(object sender, PaintEventArgs e)
        {
            if (null != this.Parent)
            {
                this.Width = this.Parent.Width - 28;
            } 
        }

        private void btnMap_MouseEnter(object sender, EventArgs e)
        {
            this.BackColor = Color.CornflowerBlue;
            //this.btnMap.BackColor = Color.CornflowerBlue;
            this.btnMap.ForeColor = Color.CornflowerBlue;
        }

        private void btnMap_Click_1(object sender, EventArgs e)
        {
            //((Button)sender).BackgroundImage = global::simpleGUI_QLQTPM.Properties.Resources.map_Click;
            ((Button)sender).BackColor = Color.SteelBlue;
        }

        private void btnMap_MouseLeave(object sender, EventArgs e)
        {
           // ((Button)sender).BackgroundImage = global::simpleGUI_QLQTPM.Properties.Resources.map;
           // ((Button)sender).BackColor = Color.SteelBlue;
            this.BackColor = Color.SteelBlue;
            this.btnMap.BackColor = Color.SteelBlue;
            this.btnMap.ForeColor = Color.SteelBlue;
        }

        private void lblTenDiaDiem_MouseEnter(object sender, EventArgs e)
        {
            this.BackColor = Color.CornflowerBlue;
            this.btnMap.BackColor = Color.CornflowerBlue;
            this.btnMap.ForeColor = Color.CornflowerBlue;
        }

        private void pbAnhDaiDien_MouseLeave(object sender, EventArgs e)
        {
            this.BackColor = Color.SteelBlue;
            this.btnMap.BackColor = Color.SteelBlue;
            this.btnMap.ForeColor = Color.SteelBlue;
        }

        private void lblTenDiaDiem_SizeChanged(object sender, EventArgs e)
        {
            lblToaDo.Location = new Point(lblTenDiaDiem.Location.X + lblTenDiaDiem.Width + 20, lblToaDo.Location.Y);
        }


    }
}
